package com.remote.entity;

import lombok.Data;

@Data
public class FileItem implements Comparable<FileItem> {

	private String name;
	private String path;
	private Boolean isDir;
	private Boolean isVertul;
	private String createDate;
	public String size;
	public String alertTime;
	public String createTime;

	public FileItem() {
		super();
	}

	public FileItem(String name, String path, Boolean isDir, Boolean isVertul) {
		super();
		this.name = name;
		this.path = path;
		this.isDir = isDir;
		this.isVertul = isVertul;
	}

	@Override
	public int compareTo(FileItem o) {
		boolean isVertul1 = this.isVertul;
		boolean isVertul2 = o.getIsVertul();
		// 两个值进行位运算,值不同为1,为true,参与运算
        //值相同为0,为false,不参与运算
		if (isVertul1 ^ isVertul2) {
			return isVertul1 ? 1 : -1;
		} else {
			return 0;
		}
	}
}
